package com.ocom.company.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ocom.common.entity.access.EntityMjDeviceInfo;
import com.ocom.common.enums.DataSourceEnum;
import com.ocom.common.enums.MasterSlaveEnum;
import com.ocom.common.vo.company.MjMachCountVo;
import com.ocom.company.dao.IDaoMjDeviceInfo;
import com.ocom.company.service.MjDeviceInfoService;
import com.ocom.mysql.aspect.DataSourceAspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class MjDeviceInfoServiceImpl extends ServiceImpl<IDaoMjDeviceInfo, EntityMjDeviceInfo> implements MjDeviceInfoService {


    @Autowired
    private IDaoMjDeviceInfo mjDeviceInfo;


    @Override
    @DataSourceAspect(type= DataSourceEnum.PART_DB,isMaster = MasterSlaveEnum.SLAVE)
    public List<MjMachCountVo> selectMjMachCount(Long companyId) {
        return mjDeviceInfo.selectMjMachCount();
    }

    @Override
    @DataSourceAspect(type= DataSourceEnum.PART_DB,isMaster = MasterSlaveEnum.SLAVE)
    public Integer selectCount(Long companyId) {
        QueryWrapper<EntityMjDeviceInfo> queryWrapper=new QueryWrapper<>();
        return this.count(queryWrapper);
    }
}
